<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 
<%
String path = request.getContextPath();
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>编辑用户</title>
  </head>
  <script type="text/javascript">
	(function($){  
     $.imap = function(){  
          var imap = this.map = {};  
          this.get = function(key){  
              var val = eval("imap."+key);  
              return  (typeof val === undefined) ? null : val;  
          };  
          this.set = function(key,value){  
              eval("imap."+key+"=value");  
          };  
     };  
  })(jQuery); 
  
  var map = new jQuery.imap();
  
  function changeTemplate(templageId){
  	if(map.get('T'+templageId) == "COMMON"){
  		$("#sendTimeGroup").show();
  	}else{
  		$("#sendTimeGroup").hide();
  	}
  }
  
</script>
  <body>
	<div class="pageContent">
		<form method="post" action="<%=path %>/membercardService/saveMembercardService.action" class="pageForm required-validate" onsubmit="return validateCallback(this, navTabAjaxDone);">
			<div class="pageFormContent" layoutH="56">
				<p>
					<label>会员卡编码：</label>
					<input name="membercardServiceVO.memberCard.id"  type="hidden"  value="<s:property value="membercardServiceVO.memberCard.id" />"type="text" size="30"/>
					<input name="membercardServiceVO.id"  type="hidden"  value="<s:property value="membercardServiceVO.id" />" type="text" size="30"/>
					<input name="membercardServiceVO.memberCard.schemeCode" value="<s:property value="membercardServiceVO.memberCard.schemeCode" />" readonly type="text" size="30"/>
				</p>
				<p>
					<label>消息类型：</label>
					<select name="membercardServiceVO.msgType">
                        <option value="">选择消息类型</option>
                        <c:forEach var="item" items="${msgTypes}">
                        		<option value="${item.name}" ${membercardServiceVO.msgType eq item.name ? "selected" : "" }>${item.title}</option>
                        </c:forEach>
                   </select>
				</p>
				
				<p>
					<label>模板：</label>
					<select name="membercardServiceVO.template.id" onchange="changeTemplate(this.value);">
                        <option value="">选择模板</option>
                        <c:forEach var="item" items="${serviceTemplates}">
                        	<c:if test="${item.id != 'ALL'}">
                        		<option value="${item.id}" ${membercardServiceVO.template.id eq item.id?"selected":"" }>${item.name}</option>
                        		<script>map.set('T${item.id}','${item.targetType}');</script>
                        	</c:if>
                        </c:forEach>
                   </select>
				</p>
				
				<p  id="sendTimeGroup" style="display:${membercardServiceVO.template.targetType=='COMMON' ? 'block' : 'none'}">
						  <label>发送时间：</label>
					      <input type="text" name="membercardServiceVO.sendTime" class="date" value="<s:date name='membercardServiceVO.sendTime' format="yyyy-MM-dd HH:mm:ss"/>" dateFmt="yyyy-MM-dd HH:mm:ss" readonly="true"/>
					      <a class="inputDateButton" href="javascript:;">选择</a>
				</p>
			</div>
			<div class="formBar">
				<ul>
					<li><div class="buttonActive"><div class="buttonContent"><button type="submit">保存</button></div></div></li>
					<li>
						<div class="button"><div class="buttonContent"><button type="button" class="close">取消</button></div></div>
					</li>
				</ul>
			</div>
		</form>
	</div>
  </body>
</html>